using System;
using Framework;
using UnityEngine;

namespace GameCore
{
    public class InventoryCloseButton : MonoBehaviour
    {
        public Inventory inventory;
        public SpriteRenderer sr;
        public Color normalColor = Color.white;
        public Color hoverColor = Color.red;
        public Color pressedColor = new Color(0.7f, 0, 0);

        private void OnMouseEnter()
        {
            sr.color = hoverColor;
        }

        public void OnMouseExit()
        {
            sr.color = normalColor;
        }

        public void OnMouseDown()
        {
            sr.color = pressedColor;
        }

        public void OnMouseUpAsButton()
        {
            inventory.Hide();
            sr.color = normalColor;
        }
    }
}